<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>滨海基金 -员工管理</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">

<link href="css/animate.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<link href="css/jquery-confirm.css" rel="stylesheet">
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<link href="css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="css/jquery.searchableSelect.css" rel="stylesheet">

<script src="js/jquery.min.js"></script>
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/jeditable/jquery.jeditable.js"></script>
<script src="js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript"
	src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script src="js/plugins/modal/bootstrap-modal.js"></script>
<script type="text/javascript" src="js/img_upload.js"></script>
<script type="text/javascript" src="js/fileUploadUtil.js"></script>
<script src="js/My97DatePicker/WdatePicker.js"></script>
<script src="js/jquery-confirm.js"></script>
<script src="js/common.js"></script>
<!-- <script src="js/employee.js"></script> -->
<script src="js/plugins/iCheck/icheck.min.js"></script>
<script src="js/jquery.searchableSelect.js"></script>
<style type="text/css">
/* dataTables列内容居中 */
.table>tbody>tr>td {
	text-align: center;
}

/* dataTables表头居中 */
.table>thead:first-child>tr:first-child>th {
	text-align: center;
}

#sel>select {
	width: 200px;
	height: 35px;
	float: left;
	margin-right:5px;
}
#sel>select:last-child{
	margin-right:0;
}

.sel {
	width: 100%;
	height: 50px;
	padding: 5px;
}
.defaultStyle{
	padding:0;margin-top:10px;
}
</style>
</head>
<body class="gray-bg">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>
						员工<small>信息管理</small>
					</h5>
					<div class="ibox-tools">
						<!-- <a class="btn  btn-sm btn-bitbucket" onclick="exportXLS()"> <i
				class="fa fa-share-square-o"></i> 导出xls
			</a> -->
						<button type="button" data-toggle="dropdown"
							style="border: none; color: white;"
							class="btn  btn-sm btn-bitbucket">
							导入导出 <span class="caret"></span>
						</button>
						<ul class="dropdown-menu" role="menu" style="left: -90px">
							<li><a onclick="importExcel()" class="fa fa-pencil-square-o">&nbsp;导入数据</a>
							</li>
							<li><a onclick="exportXLS()" class="fa fa-share-square-o">&nbsp;导出数据</a>
								<form id="exportForm"></form></li>
						</ul>
					</div>
					<div class="ibox-content">
						<div class="col-md-12" style="padding-left:0;">
							<div class="col-md-6 defaultStyle" id="sel" style="width: 756px;">
							<select class="form-control" style="width: 80px"
								onchange="Search()" id="empStatus">
								<option value="">全部</option>
								<option value="2">离职</option>
								<option value="0">在职</option>
							</select>
							<c:if
								test="${loginUser.quarters eq 5 or loginUser.quarters eq 6 }">
								<select class="form-control " style="width: 150px;" id="roleSel"
									onchange="Search()">
									<option value="">-请选择角色-</option>
									<c:forEach var="role" items="${roleList }">
										<option value="${role.id }">${role.rname }</option>
									</c:forEach>
								</select>
							</c:if>
							<select class="form-control" style="width: 200px" id="company"
								onchange="cpmpanyChage1(this.value,'branch')">
								<c:forEach var="dept" items="${dept }">
									<option value="${dept.deptId }">${dept.deptName }（${dept.remake }）</option>
								</c:forEach>
							</select> <select class="form-control" style="width: 150px" id="branch"
								onchange="branchChage(this.value,'team')">
								<option value="">-请选择部门-</option>
							</select> <select class="form-control" style="width: 150px"
								onchange="Search()" id="team" onchange="">
								<option value="">-请选择团队-</option>
							</select>
						</div>
						<div class="input-group col-md-3 defaultStyle"
							style="position: relative; width: 300px; float: left;">
							<input id="empName" type="text" class="form-control"
								placeholder="请输入关键字（姓名）" /> <span class="input-group-btn">
								<button onclick="Search()" class="btn btn-info btn-search">查询</button>
								<button class="btn btn-info btn-search" onclick="addModal()"
									style="margin-left: 5px">添加</button>

							</span>
						</div>
						</div>
						<table id="employeeTable"
							class="table table-striped table-bordered table-hover dataTables-example dataTable">
							<thead>
								<tr style="height: 20px">
									<th style="width: 40px" align="center">序号</th>
									<th style="width: 60px" align="center">账号</th>
									<th style="width: 60px" align="center">姓名</th>
									<th style="width: 30px" align="center">性别</th>
									<th style="width: 50px" align="center">职务</th>
									<th style="width: 70px" align="center">所在部门</th>
									<th style="width: 70px" align="center">角色</th>
									<th style="width: 70px" align="center">联系方式</th>
									<th style="width: 50px" align="center">是否在职</th>
									<th style="width: 150px" align="center">操作</th>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
		</div>
		<!-- 移交客户 -->
		<div class="modal fade  " id='addRoleModal'>
			<div class="modal-dialog" style="width: 900px; height: 600px;">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss='modal'>×</button>

						<h2 class="modal-title" align="center">移交客户</h2>
					</div>
					<div
						style="margin: 0px auto; padding-left: 30px; width: 100%; height: 34px; position: relative; top: 10px;">
						<span style="line-height: 34px; float: left;">接收人：</span><select
							id="personLiable" class="form-control chosen-select"
							style="width: 200px; float: left; z-index: 10;" tabindex="2"
							name="personLiable"></select><img alt="" id="loadDevo"
							style="float: left; margin-left: 5px; margin-top: 10px;"
							src="img/loading-upload.gif">
					</div>

					<div class="modal-body" align="center">
						<div class="ibox-content">
							<div class="input-group col-md-5"
								style="margin-top: 0px; positon: relative; float: left; bottom: -20px;">
								<input id="customerName" type="text" class="form-control "
									placeholder="请输入关键字（名称）"/ > <span
									class="input-group-btn"> <input type="hidden"
									id="customerId">

									<button onclick="Search4()" class="btn btn-info btn-search">查询</button>
								</span>
							</div>
							<table
								class="table table-striped table-bordered table-hover dataTables-example"
								id="dataTables-example4">
								<thead>
									<tr style="height: 30px;">
										<th style="width: 50px" align="center">序号</th>
										<th style="width: 140px" align="center">名称</th>
										<th style="width: 100px" align="center">性别</th>
										<th style="width: 120px" align="center">客户类型</th>
										<th style="width: 150px" align="center">职业</th>
										<th style="width: 180px" align="center">电话</th>
										<th style="width: 100px" align="center">全选<input
											type="checkbox" id="benCheck" /></th>
									</tr>
								</thead>
							</table>
						</div>
					</div>
					<div class="modal-footer" align="center">
						<div align="center">
							<button class="btn btn-primary" id="btnAdd">确认</button>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="modal fade" id='addModal'>
			<div class="modal-dialog" style="width: 900px; height: 600px;">
				<form method="post" class="form-horizontal m-t" id="addFrom"
					enctype="multipart/form-data">
					<div class="modal-content">
						<div class="modal-header">
							<button class="close" data-dismiss='modal'>×</button>
							<h2 class="modal-title" align="center" id="title2">添加员工信息</h2>
						</div>
						<div class="modal-body" align="center">
							<div class="row form-body form-horizontal m-t">
								<div class="col-md-6 droppable sortable">
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">员工姓名<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8">
											<input type="text" name="name" id="add_name"
												class="form-control" placeholder="请输入员工姓名">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">员工账号<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8">
											<input type="text" id="add_userCard" name="userCard"
												class="form-control" disabled="disabled"
												placeholder="请输入员工账号">

										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">员工密码<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8">

											<input id="add_password" name="password" class="form-control"
												type="password">

										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8 i-checks" style="text-align: left;">
											<label class="radio-inline"> <input type="radio"
												checked="" value="男" id="optionsRadios1" name="sex">&nbsp;男
											</label> <label class="radio-inline"> <input type="radio"
												value="女" id="optionsRadios2" name="sex">&nbsp;女
											</label>
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">手机号码： </label>
										<div class="col-sm-8">
											<input type="text" name="phoneNumber" id="add-phoneNumber"
												class="form-control" placeholder="请输入手机号码">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">角&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;色<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8">
											<select class="form-control" name="rid" id="add-role">
												<option value="">-请选择角色-</option>
											</select>
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">隶属单位<span
											style="color: red;">*</span>：
										</label>
										<div class="col-sm-8">
											<select class="form-control" name="deptId" id="add-dept"
												onchange="cpmpanyChage(this.value,'add-branch')">
												<option value="">-请选择-</option>
											</select>

										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">隶属部门： </label>
										<div class="col-sm-8">
											<select class="form-control" name="branchId" id="add-branch"
												onchange="teamChage(this.value,'add-team')">
												<option value="">-请选择-</option>
											</select>

										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-4 control-label">隶属团队： </label>
										<div class="col-sm-8">
											<select class="form-control" name="teamId" id="add-team">
												<option value="">-请选择-</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-6 droppable sortable">
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">头&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;像：</label>
										<div class="col-sm-8">
											<input type="file" name="hotelImgFile" id="hotelImgFile1"
												class="form-control" multiple="multiple"
												style="display: none;"> <input type="hidden"
												name="picture" id="add_picture" />
											<div class="input-append">
												<input id="photoCover" type="text" class="form-control"
													style="float: left; width: 144px" readonly="readonly">
												<a class="btn btn-default"
													style="border-radius: 0px; width: 50px"
													onclick="$('input[id=hotelImgFile1]').click();">浏览</a>
											</div>
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">电子邮箱： </label>
										<div class="col-sm-8">
											<input type="text" name="email" id="add_email"
												class="form-control" placeholder="请输入电子邮箱">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">工作年限 ： </label>
										<div class="col-sm-8">
											<input type="text" name="serviceYear" ; id="add-serviceYear"
												class="form-control"
												onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd '})"
												placeholder="请输入工作年限">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">身份证号码：</label>
										<div class="col-sm-8">
											<input type="text" name="idCard" id="add_idCard"
												class="form-control" placeholder="请输入身份证号码">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">出生日期：</label>
										<div class="col-sm-8">
											<input type="text" name="birthday" id="add-birthday"
												class="form-control"
												onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd '})"
												placeholder="请输入出生日期">
										</div>
									</div>

									<div class="form-group draggable">
										<label class="col-sm-3 control-label">住&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</label>
										<div class="col-sm-8">
											<input type="text" name="address" id="add_address"
												class="form-control" placeholder="请输入住址">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务：</label>
										<div class="col-sm-8">
											<input type="text" name="position" id="add_position"
												class="form-control" placeholder="请输入职务">
										</div>
									</div>
									<div class="form-group draggable">
										<label class="col-sm-3 control-label">岗&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位：</label>
										<div class="col-sm-8">
											<select class="form-control" name="quarters"
												id="add_quarters">
												<option value="0">无</option>
												<option value="1">团队长</option>
												<option value="2">部门经理</option>
												<option value="3">分部负责人</option>
												<option value="7">分部运营</option>
												<option value="8">分部人事</option>
												<option value="4">总部一般人员</option>
												<option value="5">总部管理人员</option>
												<option value="6">总部负责人</option>
											</select>
										</div>
									</div>
								</div>
							</div>

						</div>
						<div class="modal-footer" align="center">
							<div align="center" id="btd">
								<input type="hidden" name="status" value="0">
								<button type="button" class="btn btn-info"
									onclick="insertEmployee()">保存</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal fade" id='editModal'>
		<div class="modal-dialog" style="width: 900px; height: 600px;">
			<div class="modal-content">
				<form method="post" class="form-horizontal m-t" id="editForm"
					enctype="multipart/form-data">
					<div class="modal-header">
						<button class="close" data-dismiss='modal'>×</button>
						<h2 class="modal-title" align="center" id="title2">编辑员工信息</h2>
					</div>
					<div class="modal-body" align="center">
						<div class="row form-body form-horizontal m-t">
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">员工姓名<span
										style="color: red;">*</span>：
									</label>
									<div class="col-sm-8">
										<input type="text" name="name" id="edit-name"
											class="form-control" placeholder="请输入员工姓名">
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">员工账号<span
										style="color: red;">*</span>：
									</label>
									<div class="col-sm-8">
										<input type="text" name="userCard" id="edit-userCard"
											class="form-control" placeholder="请输入员工账号">
									</div>
								</div>

								<div class="form-group draggable">
									<label class="col-sm-4 control-label">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别<span
										style="color: red;">*</span>：
									</label>
									<div class="col-sm-8 i-checks" style="text-align: left;">
										<label class="radio-inline"> <input type="radio"
											value="男" id="edit-optionsRadios1" name="sex">&nbsp;男
										</label> <label class="radio-inline"> <input type="radio"
											value="女" id="edit-optionsRadios2" name="sex">&nbsp;女
										</label>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">角&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;色<span
										style="color: red;">*</span>：
									</label>
									<div class="col-sm-8">
										<select class="form-control" name="rid" id="edit-role">
											<option value="">-请选择角色-</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">隶属单位<span
										style="color: red;">*</span>：
									</label>
									<div class="col-sm-8">
										<select class="form-control" name="deptId" id="edit-dept"
											onchange="cpmpanyChage(this.value,'edit-branch')">
											<option value="">-请选择-</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">隶属部门： </label>
									<div class="col-sm-8">
										<select class="form-control" name="branchId" id="edit-branch"
											onchange="teamChage(this.value,'edit-team')">
											<option value="">-请选择-</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">隶属团队： </label>
									<div class="col-sm-8">
										<select class="form-control" name="teamId" id="edit-team">
											<option value="">-请选择-</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务：</label>
									<div class="col-sm-8">
										<input type="text" name="position" id="edit-position"
											class="form-control" placeholder="请输入职务">
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">岗&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位：</label>
									<div class="col-sm-8">
										<select class="form-control" name="quarters"
											id="edit-quarters">
											<option value="0">-无-</option>
											<option value="1">团队长</option>
											<option value="2">部门经理</option>
											<option value="3">分公司负责人</option>
											<option value="7">分部运营</option>
											<option value="8">分部人事</option>
											<option value="4">总部一般人员</option>
											<option value="5">总部管理人员</option>
											<option value="6">总部负责人</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">住&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</label>
									<div class="col-sm-8">
										<input type="text" name="address" id="edit-address"
											class="form-control" placeholder="请输入住址">
									</div>
								</div>
							</div>
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">头&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;像：</label>
									<div class="col-sm-7">
										<img src="img/error-img.png" style="margin-right: 80px;"
											width="140" height="93" id="edit-picture1"
											onerror="this.src='img/error-img.png'" /> <input type="file"
											name="hotelImgFile" id="hotelImgFile2" class="form-control"
											multiple="multiple" value="更换头像" style="display: none;">
										<input type="hidden" name="picture" id="edit-picture" /> <input
											type="hidden" name="operation" value="修改"> <input
											type="hidden" name="employeeId" id="edit-employeeId">
										<div class="input-append">
											<input id="photoCover2" type="text" class="form-control"
												style="float: left; width: 144px" readonly="readonly">
											<a class="btn btn-default"
												style="border-radius: 0px; width: 50px"
												onclick="$('input[id=hotelImgFile2]').click();">浏览</a>
										</div>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">入职日期 ： </label>
									<div class="col-sm-7">
										<input type="text" name="serviceYear" class="form-control"
											onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd '})"
											placeholder="请输入工作年限" id="edit-serviceYear" />
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">身份证号码：</label>
									<div class="col-sm-7">
										<input type="text" name="idCard" id="edit-idCard"
											class="form-control" placeholder="请输入身份证号码">
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">出生日期：</label>
									<div class="col-sm-7">
										<input type="text" name="birthday" class="form-control"
											onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd '})"
											placeholder="请输入出生日期" id="edit-birthday">
									</div>
								</div>


								<div class="form-group draggable">
									<label class="col-sm-4 control-label">在职情况：</label>
									<div class="col-sm-7">
										<select class="form-control" name="workConditions"
											id="edit-workConditions">
											<option value="0">在岗</option>
											<option value="1">请假</option>
											<option value="2">休假</option>
										</select>
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">手机号码： </label>
									<div class="col-sm-7">
										<input type="text" name="phoneNumber" id="edit-phoneNumber"
											class="form-control" placeholder="请输入手机号码">
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-4 control-label">电子邮箱： </label>
									<div class="col-sm-7">
										<input type="text" name="email" class="form-control"
											placeholder="请输入电子邮箱" id="edit-email">
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer" align="center">
						<div align="center" id="btd">
							<button type="button" class="btn btn-info"
								onclick="updateEmployee()">确认</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal fade" id='detailModal1'>
		<div class="modal-dialog" style="width: 750px; height: 600px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>

					<h2 class="modal-title" align="center">员工详细信息</h2>
				</div>

				<div class="modal-body" align="center">
					<div class="row form-body form-horizontal m-t">
						<div class="col-md-6 droppable sortable">
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">员工工号： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-employeeId"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">账号： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-userCard"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">员工姓名： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-name"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">性别： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-sex"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">职务：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-position"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">岗位：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-quarters"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">隶属单位：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-deptName"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">隶属部门：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-branchName">2</p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">隶属团队：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-teamName">1</p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">手机号码： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-phoneNumber"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">角色：</label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-rname"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-5 control-label">工作年限： </label>
								<div class="col-sm-5">
									<p class="form-control-static" id="detail-serviceYear"></p>
								</div>
							</div>
						</div>
						<div class="col-md-6 droppable sortable">
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">头像：</label>
								<div class="col-sm-4">
									<img alt="" width="150px" height="120px" src=""
										id="detail-picture" onerror="this.src='img/error-img.png'">
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">出生日期：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-birthday"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">在职情况：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-workConditions"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">录入时间：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-createDate"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">录入人：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-createPeople"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">住址：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-address"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">是否启用：</label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-status"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">邮箱： </label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-email"></p>
								</div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">身份证号码： </label>
								<div class="col-sm-4">
									<p class="form-control-static" id="detail-idCard"></p>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer" align="center">
					<div align="center">
						<button class="btn btn-primary" onclick="closeModal(detailModal1)">确认</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!--修改密码的模态层  -->
	<div class="modal fade  " id='modifyPasswordModal'>
		<div class="modal-dialog" style="width: 500px; height: 500px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>
					<h2 class="modal-title" align="center">修改密码</h2>
				</div>

				<div class="modal-body" align="center">
					<form class="form-horizontal m-t" id="signupForm">
						<div class="form-group">
							<label class="col-sm-3 control-label">用户名：</label>
							<div class="col-sm-8">
								<input id="modify-name" name="name" class="form-control"
									type="text" disabled="disabled"> <input id="modify-id"
									name="id" class="form-control" type="hidden">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">员工账号：</label>
							<div class="col-sm-8">
								<input id="modify-userCard" name="userCard" class="form-control"
									type="text" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">手机号码：</label>
							<div class="col-sm-8">
								<input id="modify-phoneNumber" name="phoneNumber"
									class="form-control" type="text" disabled="disabled">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">新密码<span
								style="color: red;">*</span>：
							</label>
							<div class="col-sm-8">
								<input id="modify-password" name="password" class="form-control"
									type="password">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">确认新密码<span
								style="color: red;">*</span>：
							</label>
							<div class="col-sm-8">
								<input id="modify-confirm_password" name="confirm_password"
									class="form-control" type="password"> <span
									style="text-align: left;" class="help-block m-b-none"><i
									class="fa fa-info-circle"></i> 请再次输入您的新密码</span>
							</div>
						</div>
					</form>
					<div class="modal-footer" align="center">
						<div align="center">
							<button class="btn btn-primary" id="modifyPasswordBtn"
								type="button">提交</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--兼任的分公司信息  -->
	<div class="modal fade" id='addInviteCustomerModal'>
		<div class="modal-dialog" style="width: 800px; height: 600px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close"
						onclick="modalClose('#addInviteCustomerModal')">×</button>

					<h2 class="modal-title" align="center" id="title">兼任管理</h2>

				</div>

				<div class="modal-body" align="center">
					<input type="hidden" id="pluralizeEmployeeId">
					<div class="ibox-content" id="deptModal">
						<div class="input-group col-md-5"
							style="margin-top: 0px; positon: relative; float: left; bottom: -5px;">
							<input id="inviteCustomerTitle" type="text" class="form-control "
								placeholder="请输入关键字（分公司名称）"/ > <span
								class="input-group-btn">
								<button onclick="Search3()" class="btn btn-info btn-search">查询</button>
							</span>
						</div>
						<table
							class="table table-striped table-bordered table-hover dataTables-example"
							id="dataTables-example3">
							<thead>
								<tr style="height: 30px">
									<th style="width: 50px" align="center">序号</th>
									<th style="width: 150px" align="center">分公司名称</th>
									<th style="width: 130px" align="center">是否兼任</th>
								</tr>
							</thead>
						</table>
						<div style="text-align: left;" id="pluralismDept"></div>
					</div>


					<div class="ibox-content" id="branchModal">
						<div class="sel">
							<select class="form-control" style="width: 200px"
								id="pluralizeBranch" onchange="Search5()">
								<c:forEach var="dept" items="${dept }" varStatus="i">
									<c:if test="${not empty dept.deptId }">
										<option value="${dept.deptId }">${dept.deptName }（${dept.remake }）</option>
									</c:if>
								</c:forEach>
							</select>
						</div>
						<div class="input-group col-md-5"
							style="margin-top: 0px; positon: relative; float: left; bottom: -5px;">
							<input id="inviteCustomerTitle" type="text" class="form-control "
								placeholder="请输入关键字（部门名称）"/ > <span
								class="input-group-btn">
								<button onclick="Search5()" class="btn btn-info btn-search">查询</button>
							</span>
						</div>
						<table
							class="table table-striped table-bordered table-hover dataTables-example"
							id="dataTables-example5">
							<thead>
								<tr style="height: 30px">
									<th style="width: 50px" align="center">序号</th>
									<th style="width: 150px" align="center">部门名称</th>
									<th style="width: 130px" align="center">是否兼任</th>
								</tr>
							</thead>
						</table>
						<div style="text-align: left;" id="pluralismBranch"></div>
					</div>


					<div class="ibox-content" id="teamModal">
						<div class="sel">
							<select class="form-control" style="width: 200px"
								id="pluralizeTeam" onchange="cpmpanyBranch(this.value)">
								<c:forEach var="dept" items="${dept }">
									<c:if test="${not empty dept.deptId }">
										<option value="${dept.deptId }">${dept.deptName }（${dept.remake }）</option>
									</c:if>
								</c:forEach>
							</select> <select class="form-control" style="width: 150px"
								id="pluralizeBranchBranch" onchange="Search6()">
								<option value="">-请选择部门-</option>
							</select>
						</div>
						<div class="input-group col-md-5"
							style="margin-top: 0px; positon: relative; float: left; bottom: -5px;">
							<input id="inviteCustomerTitle" type="text" class="form-control "
								placeholder="请输入关键字（团队名称）"/ > <span
								class="input-group-btn">
								<button onclick="Search6()" class="btn btn-info btn-search">查询</button>
							</span>
						</div>
						<table
							class="table table-striped table-bordered table-hover dataTables-example"
							id="dataTables-example6">
							<thead>
								<tr style="height: 30px">
									<th style="width: 50px" align="center">序号</th>
									<th style="width: 150px" align="center">团队名称</th>
									<th style="width: 130px" align="center">是否兼任</th>
								</tr>
							</thead>
						</table>
						<div style="text-align: left;" id="pluralismTeam"></div>
					</div>
				</div>
				<div class="modal-footer" align="center">
					<div align="center" id="btd">
						<button class="btn btn-info" onclick="getYes()">确认</button>
						<button class="btn btn-default" onclick="getNo()">关闭</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--修改设备码的模态层  -->
	<div class="modal fade  " id='deviceCodeModal'>
		<div class="modal-dialog" style="width: 500px; height: 500px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>
					<h2 class="modal-title" align="center">设备码</h2>
				</div>

				<div class="modal-body" align="center">
					<form class="form-horizontal m-t" id="deviceCodeForm">
						<div class="form-group">
							<label class="col-sm-3 control-label">用户名：</label>
							<div class="col-sm-8">
								<input id="deviceCode-name" name="name" class="form-control"
									type="text" disabled="disabled"> <input
									id="deviceCode-id" name="id" class="form-control" type="hidden">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">手机设备码(android)：</label>
							<div class="col-sm-8">
								<input id="mobileDeviceCode" name="mobileDeviceCode"
									class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">手机设备码(ios)：</label>
							<div class="col-sm-8">
								<input id="pcDeviceCode" name="pcDeviceCode"
									class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">平板设备码(android)： </label>
							<div class="col-sm-8">
								<input id="panelComputerDeviceCode"
									name="panelComputerDeviceCode" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">平板设备码(ios)： </label>
							<div class="col-sm-8">
								<input id="iosPanelComputerDeviceCode"
									name="iosPanelComputerDeviceCode" class="form-control"
									type="text">
							</div>
						</div>
					</form>
					<div class="modal-footer" align="center">
						<div align="center">
							<button class="btn btn-primary" id="deviceCodeBtn" type="button">确定</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id='importModal'>
		<div class="modal-dialog" style="width: 500px; height: 600px;">
			<div class="modal-content">
				<form method="post" class="form-horizontal m-t" id="importEmployee"
					enctype="multipart/form-data">
					<div class="modal-header">
						<button class="close" data-dismiss='modal'>×</button>
						<h2 class="modal-title" align="center" id="title2">导入员工资料</h2>
					</div>
					<div class="modal-body" align="center">
						<div class="row form-body form-horizontal m-t">
							<div class="form-group draggable">
								<label class="col-sm-4 control-label">选择文件(Excel)：</label>
								<div class="col-sm-">
									<input type="file" name="uploadFile" id="hotelImgFile3"
										class="form-control" multiple="multiple"
										style="display: none;">
									<div class="input-append">
										<input id="photoCover3" type="text" class="form-control"
											style="float: left; width: 170px" readonly="readonly">
										<a class="btn btn-default"
											style="border-radius: 0px; width: 50px; float: left;"
											onclick="$('input[id=hotelImgFile3]').click();">浏览</a>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer" align="center">
						<div align="center" id="btd">
							<button type="button" class="btn btn-info"
								onclick="importEmployee()">确认</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	var arrayList = new Array();
	var deleteList = new Array();
	var pType = "";
	//打开导入excel文件窗口
	function importExcel() {
		$("#importEmployee")[0].reset();
		$("#importModal").modal("show");
	}
	// 导出数据
	function exportXLS() {
		$('#exportForm').attr('action', 'createExcel.do');
		$('#exportForm').attr('target', '_blank');
		$('#exportForm').submit();
	}
	// 删除员工
	function delEmployee(id) {
		swal({
			title : "提示",
			text : "确认删除该员工？",
			type : "warning",
			showCancelButton : true,
			confirmButtonColor : "#DD6B55",
			confirmButtonText : "确定",
			cancelButtonText : "取消",
			closeOnConfirm : false
		}, function() {
			$.ajax({
				url : "getCustomerCount.do",
				data : {
					empId : id
				},
				type : "post",
				dataType : "json",
				success : function(result) {
					if (result.code == 0) {
						if (result.count > 0) {
							swal({
								title : "提示",
								text : "请先移交客户！",
								type : "info",
								confirmButtonColor : "#DD6B55",
								confirmButtonText : "确定"
							}, function() {
								return;
							});
						} else {
							$.ajax({
								url : "delEmployee.do",
								data : {
									empId : id
								},
								type : "post",
								dataType : "json",
								success : function(result) {
									if (result.code == 1) {
										swal({
											title : "提示",
											text : "删除成功！",
											type : "success",
											confirmButtonColor : "#DD6B55",
											confirmButtonText : "确定"
										}, function() {
											Search();
										});

									} else if (result.code == -1) {
										sweetAlert("错误", "出现未知错误!", "error");
									} else {
										sweetAlert("错误", "暂无数据!", "error");
									}
								},
								error : function() {
									sweetAlert("异常", "网络出现异常!", "error");
								}

							})
						}
					} else if (result.code == -1) {
						sweetAlert("错误", "操作失败,请刷新后重试!", "error");
					} else {
						sweetAlert("错误", "设置失败!", "error");
					}
				},
				error : function() {
					sweetAlert("异常", "网络出现异常!", "error");
				}

			})
		});
	}
	// 设置员工离职
	function dimission(id) {
		swal({
			title : "提示",
			text : "确认设置该员工离职？",
			type : "warning",
			showCancelButton : true,
			confirmButtonColor : "#DD6B55",
			confirmButtonText : "确定",
			cancelButtonText : "取消",
			closeOnConfirm : false
		}, function() {
			$.ajax({
				url : "getCustomerCount.do",
				data : {
					empId : id
				},
				type : "post",
				dataType : "json",
				success : function(result) {
					if (result.code == 0) {
						if (result.count > 0) {
							swal({
								title : "提示",
								text : "请先移交客户！",
								type : "info",
								confirmButtonColor : "#DD6B55",
								confirmButtonText : "确定"
							}, function() {
								return;
							});
						} else {
							$.ajax({
								url : "dimissionEmployee.do",
								data : {
									empId : id
								},
								type : "post",
								dataType : "json",
								success : function(result) {
									if (result.code == 1) {

										swal({
											title : "提示",
											text : "设置成功！",
											type : "success",
											confirmButtonColor : "#DD6B55",
											confirmButtonText : "确定"
										}, function() {
											Search();

										});

									} else if (result.code == -1) {
										sweetAlert("错误", "操作失败,请刷新后重试!",
												"error");
									} else {
										sweetAlert("错误", "设置失败!", "error");
									}
								},
								error : function() {
									sweetAlert("异常", "网络出现异常!", "error");
								}

							})
						}
					} else if (result.code == -1) {
						sweetAlert("错误", "操作失败,请刷新后重试!", "error");
					} else {
						sweetAlert("错误", "设置失败!", "error");
					}
				},
				error : function() {
					sweetAlert("异常", "网络出现异常!", "error");
				}

			})

		});
	}
	function addModal() {
		$.ajax({
			url : "toAddEmployee.do",
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					$("#name").val("");
					$("#add_userCard").val("");
					$("#add_userCard").removeAttr("disabled");
					$("#password").val("");
					$("#add-role").val("");
					$("#add-dept").val("");
					$("#add-branch").val("");
					$("#add-team").val("");
					$("#picture").val("");
					$("#email").val("");
					$("#add-serviceYear").val("");
					$("#idCard").val("");
					$("#add-birthday").val("");
					$("#address").val("");
					$("#phoneNumber").val("");
					$("#add-position").val("");
					$("#add-quarters").val("");
					$("#addModal").modal("show");
					$("#photoCover").val("");
					var dept = result.deptList;
					var role = result.roleList;
					var deptHtml = "";
					var roleHtml = "";
					$('#add-dept option').not(":first").remove();
					$('#add-role option').not(":first").remove();
					for (var i = 0; i < dept.length; i++) {
						deptHtml += "<option value='" + dept[i].deptId + "'>"
								+ dept[i].deptName + "（" + dept[i].remake + "）"
								+ "</option>";
					}
					for (var i = 0; i < role.length; i++) {
						roleHtml += "<option value='" + role[i].id + "'>"
								+ role[i].rname + "</option>";
					}
					$("#add-dept").append(deptHtml);
					$("#add-role").append(roleHtml);
				} else {
					sweetAlert("异常", "访问服务器异常!", "error");
				}
			},
			error : function() {
				sweetAlert("异常", "网络出现异常!", "error");
			}
		})

	}
	function detailModal(id) {
		$.ajax({
			url : "queryEmployeeById.do",
			data : {
				empId : id
			},
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					$("#detailModal1").modal("show");
					var emp = result.emp;
					var work = "";
					if (emp.workConditions == 0) {
						work = "在岗"
					} else if (emp.workConditions == 1) {
						work = "请假"
					} else {
						work = "休假"
					}
					$("#detail-employeeId").html(emp.employeeId);
					$("#detail-userCard").html(emp.userCard);
					$("#detail-name").html(emp.name);
					$("#detail-sex").html(emp.sex);
					$("#detail-position").html(emp.position);
					if (emp.quarters == 0) {
						$("#detail-quarters").html("无");
					} else if (emp.quarters == 1) {
						$("#detail-quarters").html("团队长");
					} else if (emp.quarters == 2) {
						$("#detail-quarters").html("部门经理");
					} else if (emp.quarters == 3) {
						$("#detail-quarters").html("分部负责人");
					} else if (emp.quarters == 4) {
						$("#detail-quarters").html("总部一般人员");
					} else if (emp.quarters == 5) {
						$("#detail-quarters").html("总部管理人员");
					} else if (emp.quarters == 6) {
						$("#detail-quarters").html("总部负责人");
					} else if (emp.quarters == 7) {
						$("#detail-quarters").html("分部运营");
					} else if (emp.quarters == 8) {
						$("#detail-quarters").html("分部人事");
					}
					$("#detail-phoneNumber").html(emp.phoneNumber);
					$("#detail-rname").html(emp.role.rname);
					$("#detail-email").html(emp.email);
					$("#detail-serviceYear").html(
							FormatDate(new Date(emp.serviceYear)));
					$("#detail-idCard").html(emp.idCard);
					if (emp.picture != null) {
						$("#detail-picture").attr("src", emp.picture);
					} else {
						$("#detail-picture").attr("src", "");
					}

					$("#detail-birthday").html(
							FormatDate(new Date(emp.birthday)));
					$("#detail-workConditions").html(work);
					$("#detail-createDate").html(
							FormatDate(new Date(emp.createDate)));
					$("#detail-createPeople").html(emp.createPeople);
					$("#detail-address").html(emp.address);
					$("#detail-deptName").html(
							emp.dept != null ? emp.dept.deptName + "（"
									+ emp.dept.remake + "）" : "无");
					$("#detail-branchName").html(
							emp.branch != null ? emp.branch.branchName : "无");
					$("#detail-teamName").html(
							emp.team != null ? emp.team.branchName : "无");
					$("#detail-status").html(emp.status == "0" ? "是" : "否");
					if (emp.quarters == 0) {
						$("#detail-quarters").html("无");
					} else if (emp.quarters == 1) {
						$("#detail-quarters").html("团队长");
					} else if (emp.quarters == 2) {
						$("#detail-quarters").html("部门经理");
					} else if (emp.quarters == 3) {
						$("#detail-quarters").html("分部负责人");
					} else if (emp.quarters == 4) {
						$("#detail-quarters").html("总部一般人员");
					} else if (emp.quarters == 5) {
						$("#detail-quarters").html("总部管理人员");
					} else if (emp.quarters == 6) {
						$("#detail-quarters").html("总部负责人");
					} else if (emp.quarters == 7) {
						$("#detail-quarters").html("分部运营");
					} else if (emp.quarters == 8) {
						$("#detail-quarters").html("分部人事");
					}
				} else {
					sweetAlert("异常", "访问服务器异常!", "error");
				}
			},
			error : function() {
				sweetAlert("异常", "网络出现异常!", "error");
			}

		})
	}
	function editModal(id) {
		$("#editForm")[0].reset();
		$("#edit-picture").empty();
		$
				.ajax({
					url : "queryEmployeeById.do",
					data : {
						empId : id
					},
					type : "post",
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							$("#editModal").modal("show");
							var emp = result.emp;
							var dept = result.deptList;
							var role = result.roleList;
							var deptHtml = "";
							var roleHtml = "";
							$('#edit-dept option').not(":first").remove();
							$('#edit-role option').not(":first").remove();
							if (emp.dept != null) {
								for (var i = 0; i < dept.length; i++) {
									if (dept[i].deptId == emp.dept.deptId) {
										deptHtml += "<option selected=\"selected\" value='"
											+ dept[i].deptId
											+ "'>"
												+ dept[i].deptName
												+ "（"
												+ dept[i].remake
												+ "）"
												+ "</option>";
									} else {
										deptHtml += "<option value='"
											+ dept[i].deptId + "'>"
												+ dept[i].deptName
												+ "（"
												+ dept[i].remake
												+ "）"
												+ "</option>";
									}

								}
							}
							for (var i = 0; i < role.length; i++) {
								if (role[i].id == emp.role.id) {
									roleHtml += "<option selected=\"selected\" value='"
										+ role[i].id
										+ "'>"
											+ role[i].rname + "</option>";
								} else {
									roleHtml += "<option value='" + role[i].id
										+ "'>"
											+ role[i].rname + "</option>";
								}
							}

							$("#edit-branch option:not(:first)").remove();
							$("#edit-team option:not(:first)").remove();
							$("#edit-dept").append(deptHtml);
							$("#edit-role").append(roleHtml);
							if (emp.branch != null) {
								cpmpanyLoad(emp.dept.deptId,
										emp.branch.branchId);
							} else {
								$("#edit-dept").trigger("change");

							}
							if (emp.team != null && emp.branch != null) {
								cpmpanyPid(emp.branch.branchId,
										emp.team.branchId);
							} else {
								$("#edit-branch").trigger("change");
							}
							$("#edit-employeeId").val(emp.employeeId);
							$("#edit-name").val(emp.name);
							$("#edit-password").val(emp.password);
							$("#edit-userCard").val(emp.userCard);
							$("#edit-position").val(emp.position);
							$("#edit-deptName").val(emp.dept.deptName);
							$("#edit-phoneNumber").val(emp.phoneNumber);
							$("#edit-picture").val(emp.picture);
							$("#edit-picture1").attr("src", emp.picture);
							$("#edit-rname").val(emp.role.rname);
							$("#edit-email").val(emp.email);
							$("#edit-quarters").val(emp.quarters);
							// $("#photoCover2").val(emp.picture);
							if (emp.serviceYear != null
									|| emp.serviceYear != "") {
								$("#edit-serviceYear").val(
										FormatDate(new Date(emp.serviceYear)));
							}
							if (emp.birthday != null || emp.serviceYear != "") {
								$("#edit-birthday").val(
										FormatDate(new Date(emp.birthday)));
							}
							if (emp.createDate != null || emp.serviceYear != "") {
								$("#edit-createDate").val(
										FormatDate(new Date(emp.createDate)));
							}

							$("#edit-idCard").val(emp.idCard);

							$("#edit-workConditions").val(emp.workConditions);

							$("#edit-createPeople").val(emp.createPeople);
							$("#edit-address").val(emp.address);
							$("#edit-optionsRadios1").removeAttr("checked");
							$("#edit-optionsRadios2").removeAttr("checked");
							if (emp.sex != null && emp.sex != "") {
								$(":radio[name='sex'][value='" + emp.sex + "']")
										.iCheck('check');
							}
						} else {
							sweetAlert("异常", "访问服务器异常!", "error");
						}
					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				})
	}
	// 添加用户
	function insertEmployee() { // “登录”按钮单击事件
		if ($("#add_name").val() == "") {
			swal("提示!", "请输入员工姓名!", "error");
			return;
		}
		if ($("#add_userCard").val() == "") {
			swal("提示!", "请输入员工账号!", "error");
			return;
		}
		if ($("#add_password").val() == "") {
			swal("提示!", "请输入员工密码!", "error");
			return;
		}
		if ($("#add-dept").val() == "") {
			swal("提示!", "请选择隶属部门!", "error");
			return;
		}
		if ($("#add-role").val() == "") {
			swal("提示!", "请选择角色!", "error");
			return;
		}
		if ($("#add-phoneNumber").val() != ""
				&& $("#add-phoneNumber").val().length != 11) {
			swal("提示!", "请填写正确的手机号码!", "error");
			return false;
		}
		FileUpload("insertEmployee.do", "#addFrom", function(data) {
			if (data.code == 1) {
				swal({
					title : "提示",
					text : "添加成功！",
					type : "success",
					confirmButtonText : "确定"
				}, function() {
					$("#addModal").modal("hide");
					$('#addFrom')[0].reset();
					Search();
				});
			} else if (data.code == 2) {
				swal({
					title : "提示",
					text : "添加成功！但检测到微信企业中未存在该用户信息请及时添加!",
					type : "warning",
					confirmButtonText : "确定"
				}, function() {
					$("#addModal").modal("hide");
					$('#addFrom')[0].reset();
					Search();
				});

			} else if (data.code == -2) {
				swal("提示!", "手机号码或员工账号已存在!", "error");
			} else {
				swal("提示!", "保存失败!", "error");
			}
		}, function(loaded, total) {
			// 可添加模版，提示正在上传；
		}, function() {

		}, function() {
			swal("提示!", "服务器访问失败!", "error");
		});
	}
	// 编辑用户
	function updateEmployee() { // “登录”按钮单击事件

		if ($("#edit-name").val() == "") {
			swal("提示!", "请输入员工姓名!", "error");
			return;
		}
		if ($("#edit-userCard").val() == "") {
			swal("提示!", "请输入员工账号!", "error");
			return;
		}
		if ($("#edit-dept").val() == "") {
			swal("提示!", "请选择隶属部门!", "error");
			return;
		}
		if ($("#edit-role").val() == "") {
			swal("提示!", "请选择角色!", "error");
			return;
		}
		if ($("#edit-phoneNumber").val() != ""
				&& $("#edit-phoneNumber").val().length != 11) {
			swal("提示!", "请填写正确的手机号码!", "error");
			return false;
		}

		FileUpload("insertEmployee.do", "#editForm", function(data) {
			if (data.code == 1) {
				swal({
					title : "提示",
					text : "编辑成功！",
					type : "success",
					confirmButtonText : "确定"
				}, function() {
					$("#editModal").modal("hide");
					Search();
				});
			} else if (data.code == 2) {
				swal({
					title : "提示",
					text : "编辑成功！但检测到微信企业中未存在该用户信息请及时添加!",
					type : "warning",
					confirmButtonText : "确定",
					closeOnConfirm : true
				}, function() {
					$("#editModal").modal("hide");
					$("#addModal").modal("hide");
					Search();
				});
			} else if (data.code == -2) {
				swal("提示!", "手机号码或员工账号已存在!", "error");
			} else {
				swal("提示!", "保存失败!", "error");
			}
		}, function(loaded, total) {
			// 可添加模版，提示正在上传；
		}, function() {

		}, function() {
			swal("提示!", "服务器访问失败!", "error");
		});
	}
	// 导入用户
	function importEmployee() { // “登录”按钮单击事件
		var photoCover3 = $("#photoCover3").val();
		if (photoCover3 == null || photoCover3 == "") {
			swal("提示!", "请选择excel文件!", "error");
			return;
		}
		FileUpload("import_employeeExcel.do", "#importEmployee",
				function(data) {
					if (data.code == 0) {
						swal({
							title : "提示",
							text : "导入成功！",
							type : "success",
							confirmButtonText : "确定"
						}, function() {
							Search();
							$("#importModal").modal("hide");
						});
					} else if (data.code == -1) {
						swal("提示!", "操作失败,请刷新后重试!", "error");
					} else if (data.code == -2) {
						swal("提示!", "excel文件不符合规范,请按照模板要求导入!", "error");
					} else if (data.code == -3) {
						swal("提示!", "导入失败!", "error");
					} else if (data.code == -4) {
						var msg = "";
						for (var i = 0; i < data.listName.length; i++) {
							msg += data.listName[i] + ",";
						}
						msg += "的数据已存在。"
						swal("提示!", msg, "error");
					} else if (data.code == -5) {
						swal("提示!", "权限不足!", "error");
					}
				}, function(loaded, total) {
					// 可添加模版，提示正在上传；
				}, function() {

				}, function() {
					swal("提示!", "服务器访问失败!", "error");
				});
	}
	function devolveon(id) {
		$("#addRoleModal").modal("show");
		$("#customerId").val(id);
		Search4();
	}
	function loadDevolven() {
		//请求员工数据
		$.ajax({
			url : "askEmployee.do",
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					var emp = result.data;
					for (var i = 0; i < emp.length; i++) {
						$("#personLiable").append(
								"<option value="+emp[i].employeeId+" >"
										+ emp[i].name + "</option>");
					}
					$("#personLiable").searchableSelect();
					$("#loadDevo").hide();

				} else {
					sweetAlert("异常", "请求数据失败!", "error");
				}

			},
			error : function() {
				sweetAlert("异常", "网络出现异常!", "error");
			}

		});// ajax end;
	}
	var darw = 0;
	$(function() {
		loadDevolven();
		// 全选事件
		$("#benCheck").click(
				function() {
					if ($('#benCheck').is(':checked')) {
						$("input:checkbox[name='transferCustomers']").prop(
								"checked", "checked");
					} else {
						$("input:checkbox[name='transferCustomers']")
								.removeAttr("checked");
					}
				});
		$("#btnAdd").click(
				function() {
					var personLiable = $("#personLiable").val();
					var text = $(
							"input:checkbox[name='transferCustomers']:checked")
							.map(function(index, elem) {
								return $(elem).val();
							}).get().join(',');
					if (personLiable == "") {
						swal("提示!", "请选择接收人!", "error");
						return;
					}
					if (text == "") {
						swal("提示!", "请选择移交客户!", "error");
						return;
					}
					$.ajax({
						url : "transferCustomerAdmin.do",
						type : "post",
						data : {
							customerText : text,
							personLiable : personLiable
						},
						dataType : "json",
						success : function(result) {
							if (result.code == 1) {
								swal({
									title : "提示",
									text : "移交成功！",
									type : "success",
									confirmButtonText : "确定"
								}, function() {
									Search4();
								});

							} else if (result.code == 0) {
								sweetAlert("异常", "暂无数据!", "error");
							} else {
								sweetAlert("异常", "出现未知错误!", "error");
							}

						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}

					});// ajax end;
				});
		// 选择头像之后的事件
		$("#hotelImgFile1").change(
				function() {
					var file = $("#hotelImgFile1");

					var suffix = file.val().substring(
							file.val().lastIndexOf(".") + 1, file.val().length)
							.toLowerCase();
					var picture = file.val()
							.substring(file.val().lastIndexOf("\\") + 1,
									file.val().length);

					var imageSize = file[0].files[0].size / 1024;// kb

					// JPG,JPEG,PNG,BMP,GIF格式
					if (suffix != "jpg" && suffix != "jpeg" && suffix != "png"
							&& suffix != "bmp" && suffix != "gif") {
						file.val("");// 清空
						sweetAlert("提示", "仅支持10M以下JPG,JPEG,PNG,BMP,GIF格式图片!",
								"error");
					} else if (imageSize > 1024 * 5) { // 仅支持5M内的图片
						file.val("");// 清空
						sweetAlert("提示", "图片文件的大小不能超过5M!", "error");
					} else {
						$("#picture").val(file.val());
					}

				});

		//$('#personLiable').searchableSelect();

	})
	// 选择头像之后的事件
	$("#hotelImgFile2").change(
			function() {
				var file = $("#hotelImgFile2");

				var suffix = file.val().substring(
						file.val().lastIndexOf(".") + 1, file.val().length)
						.toLowerCase();
				var picture = file.val().substring(
						file.val().lastIndexOf("\\") + 1, file.val().length);

				var imageSize = file[0].files[0].size / 1024;// kb

				// JPG,JPEG,PNG,BMP,GIF格式
				if (suffix != "jpg" && suffix != "jpeg" && suffix != "png"
						&& suffix != "bmp" && suffix != "gif") {
					file.val("");// 清空
					sweetAlert("提示", "仅支持10M以下JPG,JPEG,PNG,BMP,GIF格式图片!",
							"error");
				} else if (imageSize > 1024 * 5) { // 仅支持5M内的图片
					file.val("");// 清空
					sweetAlert("提示", "图片文件的大小不能超过5M!", "error");
				} else {
					$("#picture").val(file.val());
				}

			});
	var table;
	var table3;// 分公司数据表
	var table4;// 客户移交数据表
	var table5;// 部门兼任数据表
	var table6;// 团队兼任数据表
	$(function() {
		// 提示信息
		var lang = {
			"sProcessing" : "<div style=\"float:right;width:50%\" >处理中...</div>",
			"sLengthMenu" : "每页 _MENU_ 项",
			"sZeroRecords" : "没有匹配结果",
			"sInfo" : "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
			"sInfoEmpty" : "当前显示第 0 至 0 项，共 0 项",
			"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
			"sInfoPostFix" : "",
			"sSearch" : "搜索:",
			"sUrl" : "",
			"sEmptyTable" : "表中数据为空",
			"sLoadingRecords" : "载入中...",
			"sInfoThousands" : ",",
			"oPaginate" : {
				"sFirst" : "首页",
				"sPrevious" : "上页",
				"sNext" : "下页",
				"sLast" : "末页",
				"sJump" : "跳转"
			},
			"oAria" : {
				"sSortAscending" : ": 以升序排列此列",
				"sSortDescending" : ": 以降序排列此列"
			}
		};
		var lang4 = {
			"sProcessing" : "<div style=\"float:left;width:900px;\" >处理中...</div>",
			"sLengthMenu" : "每页 _MENU_ 项",
			"sZeroRecords" : "没有匹配结果",
			"sInfo" : "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
			"sInfoEmpty" : "当前显示第 0 至 0 项，共 0 项",
			"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
			"sInfoPostFix" : "",
			"sSearch" : "搜索:",
			"sUrl" : "",
			"sEmptyTable" : "表中数据为空",
			"sLoadingRecords" : "载入中...",
			"sInfoThousands" : ",",
			"oPaginate" : {
				"sFirst" : "首页",
				"sPrevious" : "上页",
				"sNext" : "下页",
				"sLast" : "末页",
				"sJump" : "跳转"
			},
			"oAria" : {
				"sSortAscending" : ": 以升序排列此列",
				"sSortDescending" : ": 以降序排列此列"
			}
		};
		// 初始化表格
		table4 = $("#dataTables-example4")
				.dataTable(
						{

							"fnDrawCallback" : function() {
								var api = this.api();
								var startIndex = api.context[0]._iDisplayStart;// 获取到本页开始的条数
								api.column(0).nodes().each(function(cell, i) {
									cell.innerHTML = startIndex + i + 1;
								});
							},
							language : lang4, // 提示信息
							autoWidth : false, // 禁用自动调整列宽
							stripeClasses : [ "odd", "even" ], // 为奇偶行加上样式，兼容不支持CSS伪类的场合
							processing : true, // 隐藏加载提示,自行处理
							serverSide : true, // 启用服务器端分页
							searching : false, // 禁用原生搜索
							orderMulti : false, // 启用多列排序
							order : [], // 取消默认排序查询,否则复选框一列会出现小箭头
							renderer : "bootstrap", // 渲染样式：Bootstrap和jquery-ui
							pagingType : "simple_numbers", // 分页样式：simple,simple_numbers,full,full_numbers
							"aLengthMenu" : [ 10 ],
							"bLengthChange" : false,// 屏蔽tables的一页展示多少条记录的下拉列表
							ordering : false, // 关闭排序图标
							ajax : function(data, callback, settings) {
								// 封装请求参数
								var param = {};
								param.limit = data.length;// 页面显示记录条数，在页面显示每页显示多少项的时候
								param.start = data.start;// 开始的记录序号
								param.page = (data.start / data.length) + 1;// 当前页码
								// param.darw=darw; //计数器
								var customerName = $("#customerName").val()
										.trim();
								if (customerName != null && customerName != "") {
									param.customerName = customerName
								}
								param.personLiable = $("#customerId").val();
								// console.log(param);
								// ajax请求数据
								$
										.ajax({
											type : "POST",
											url : "customerList.do",
											cache : false, // 禁用缓存
											data : param, // 传入组装的参数
											dataType : "json",
											success : function(result) {

												// console.log(result);
												// setTimeout仅为测试延迟效果
												setTimeout(
														function() {
															// 封装返回数据
															var returnData = {};
															draw = result.draw;// 后台返回的计数器
															returnData.draw = data.draw;// 这里直接自行返回了draw计数器,应该由后台返回
															returnData.recordsTotal = result.total;// 返回数据全部记录
															returnData.recordsFiltered = result.total;// 后台不实现过滤功能，每次查询均视作全部结果
															returnData.data = result.data;// 返回的数据列表
															$("#benCheck")
																	.removeAttr(
																			"checked");
															// console.log(returnData);
															// 调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
															// 此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
															callback(returnData);
														}, 200);
											}
										});
							},
							// 列表表头字段
							columns : [ {
								"data" : null
							}, {
								"data" : "customerName"
							}, {
								"data" : "sex"
							}, {
								"data" : function(data) {
									if (data.customerType == 0) {
										return "自然人";
									} else if (data.customerType == 1) {
										return "老总";
									} else if (data.customerType == 2) {
										return "部门经理";
									} else if (data.customerType == 3) {
										return "部门主管";
									} else if (data.customerType == 4) {
										return "普通员工";
									} else if (data.customerType == 5) {
										return "法人";
									}
								}
							}, {
								"data" : "profession"
							}, {
								"data" : "mobileNumber"
							}

							],
							columnDefs : [ {
								"targets" : [ 6 ], // 第七列加一条 自定义列
								"data" : "customerId", // 数据列名
								"render" : function(data, type, full) { // 返回自定义的内容editCustomer

									return "<input type=\"checkbox\" name='transferCustomers' value=\""
										+ data + "\" />";
								}
							} ]
						})// .api();
		// 初始化表格
		table = $("#employeeTable")
				.dataTable(
						{

							"fnDrawCallback" : function() {
								var api = this.api();
								var startIndex = api.context[0]._iDisplayStart;// 获取到本页开始的条数
								api.column(0).nodes().each(function(cell, i) {
									cell.innerHTML = startIndex + i + 1;
								});

							},
							language : lang, // 提示信息
							autoWidth : false, // 禁用自动调整列宽
							stripeClasses : [ "odd", "even" ], // 为奇偶行加上样式，兼容不支持CSS伪类的场合
							processing : true, // 隐藏加载提示,自行处理
							serverSide : true, // 启用服务器端分页
							searching : false, // 禁用原生搜索
							orderMulti : false, // 启用多列排序
							order : [], // 取消默认排序查询,否则复选框一列会出现小箭头
							renderer : "bootstrap", // 渲染样式：Bootstrap和jquery-ui
							pagingType : "simple_numbers", // 分页样式：simple,simple_numbers,full,full_numbers
							"aLengthMenu" : [ 10 ],
							"bLengthChange" : false,// 屏蔽tables的一页展示多少条记录的下拉列表
							ordering : false, // 关闭排序图标
							bStateSave : true, // 刷新 停留在当前页
							ajax : function(data, callback, settings) {
								// 封装请求参数
								var param = {};
								param.limit = data.length;// 页面显示记录条数，在页面显示每页显示多少项的时候
								param.start = data.start;// 开始的记录序号
								param.page = (data.start / data.length) + 1;// 当前页码
								// param.darw=darw; //计数器

								var empName = $("#empName").val().trim();
								if (empName != null && empName != "") {
									param.empName = empName;
								}
								var roleSel = $("#roleSel").val();
								if (roleSel != null && roleSel != "") {
									param.roleId = roleSel;
								}
								var type;
								var deptId;
								var branchId;
								var teamId;
								var empStatus;
								if ($("#company>option:selected").val() == "") {
									typeStr = ""
								}

								if ($("#company>option:selected").val() != "") {
									deptId = $("#company>option:selected")
											.val();
								}

								if ($("#branch>option:selected").val() != "") {
									branchId = $("#branch>option:selected")
											.val();
								}
								if ($("#team>option:selected").val() != "") {
									teamId = $("#team>option:selected").val();
								}
								if ($("#empStatus>option:selected").val() != "") {
									empStatus = $("#empStatus>option:selected")
											.val();
								}
								param.deptId = deptId;
								param.branchId = branchId;
								param.teamId = teamId;
								param.empStatus = empStatus;

								// ajax请求数据
								$
										.ajax({
											type : "POST",
											url : "queryEmployeeAll.do",
											cache : false, // 禁用缓存
											data : param, // 传入组装的参数
											dataType : "json",
											success : function(result) {

												// setTimeout仅为测试延迟效果
												// 封装返回数据
												var returnData = {};
												draw = result.draw;// 后台返回的计数器
												returnData.draw = data.draw;// 这里直接自行返回了draw计数器,应该由后台返回
												returnData.recordsTotal = result.total;// 返回数据全部记录
												returnData.recordsFiltered = result.total;// 后台不实现过滤功能，每次查询均视作全部结果
												returnData.data = result.data;// 返回的数据列表

												// 调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
												// 此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
												callback(returnData);

											}
										});
							},
							// 列表表头字段
							columns : [
									{
										"data" : null
									},
									{
										"data" : function(data) {
											if (data.userCard != null
													&& data.userCard != "") {
												return data.userCard;
											} else {
												return "-";
											}
										}
									},
									{
										"data" : "name"
									},
									{
										"data" : "sex"
									},
									{
										"data" : "position"
									},
									{
										"data" : function(data) {
											if (data.dept == null
													|| data.dept.deptName == null) {
												return "";
											} else {
												return data.dept.deptName
											}
										}

									}, {
										"data" : "role.rname"
									}, {
										"data" : "phoneNumber"
									}, {
										"data" : "status"
									}

							],
							columnDefs : [
									{
										"targets" : [ 9 ], // 第11列加一条 自定义列
										"data" : "employeeId", // 数据列名
										"render" : function(data, type, full) { // 返回自定义的内容
											if (full.status == 2) {
												return "<a class=\"btn btn-info btn-xs\"  id=\"roleModal${statu.index+1 }\" onclick=\"detailModal('"
														+ data
														+ "')\"   href=\"javascript:void(0);\">详情</a>&nbsp;"
														+ "<a class=\"btn btn-danger  btn-xs\" href=\"javascript:void(0);\" onclick=\"delEmployee('"
														+ data + "')\">删除</a>";
											} else {
												return "<a class=\"btn btn-info btn-xs\"  id=\"roleModal${statu.index+1 }\" onclick=\"detailModal('"
														+ data
														+ "')\"   href=\"javascript:void(0);\">详情</a>&nbsp;"
														+ "<a class=\"btn btn-primary  btn-xs\"   href=\"javascript:void(0);\" onclick=\"editModal('"
														+ data
														+ "')\">编辑</a>&nbsp;"
														+ "<a class=\"btn btn-success  btn-xs\"   href=\"javascript:void(0);\" onclick=\"pluralizeQuery('"
														+ data
														+ "')\">兼任</a>&nbsp;"
														+ "<a class=\"btn btn-info   btn-xs\"   href=\"javascript:void(0);\" onclick=\"deviceQuery('"
														+ data
														+ "')\">设备码</a><br/>"
														+ "<a class=\"btn btn-primary  btn-xs\"   href=\"javascript:void(0);\" onclick=\"modifyPasswordBeforeQuery('"
														+ data
														+ "')\">改密</a>&nbsp;"
														+ "<a class=\"btn btn-warning  btn-xs\" onclick=\"devolveon('"
														+ data
														+ "')\">移交</a> "
														+ "<a class=\"btn btn-warning btn-xs\" onclick=\"dimission('"
														+ data
														+ "')\">离职</a> "
														+ "<a class=\"btn btn-danger  btn-xs\" href=\"javascript:void(0);\" onclick=\"delEmployee('"
														+ data + "')\">删除</a>";
											}
										}
									}, {

										"targets" : [ 8 ], // 第10列加一条 自定义列
										"data" : "status", // 数据列名
										"render" : function(data, type, full) { // 返回自定义的内容
											var result = "";
											if (data == 0) {
												result = "是";
											} else {
												result = "否";
											}

											return result;

										}

									}

							]
						})// .api();
		// 此处需调用api()方法,否则返回的是JQuery对象而不是DataTables的API对象//初始化表格3
		table3 = $("#dataTables-example3")
				.dataTable(
						{

							"fnDrawCallback" : function() {
								var api = this.api();
								var startIndex = api.context[0]._iDisplayStart;// 获取到本页开始的条数
								api.column(0).nodes().each(function(cell, i) {
									cell.innerHTML = startIndex + i + 1;
								});
							},
							language : lang, // 提示信息
							autoWidth : false, // 禁用自动调整列宽
							stripeClasses : [ "odd", "even" ], // 为奇偶行加上样式，兼容不支持CSS伪类的场合
							processing : true, // 隐藏加载提示,自行处理
							serverSide : true, // 启用服务器端分页
							searching : false, // 禁用原生搜索
							orderMulti : false, // 启用多列排序
							order : [], // 取消默认排序查询,否则复选框一列会出现小箭头
							renderer : "bootstrap", // 渲染样式：Bootstrap和jquery-ui
							pagingType : "simple_numbers", // 分页样式：simple,simple_numbers,full,full_numbers
							"aLengthMenu" : [ 10 ],
							"bLengthChange" : false,// 屏蔽tables的一页展示多少条记录的下拉列表
							ordering : false, // 关闭排序图标
							ajax : function(data, callback, settings) {
								// 封装请求参数
								var param = {};
								param.limit = data.length;// 页面显示记录条数，在页面显示每页显示多少项的时候
								param.start = data.start;// 开始的记录序号
								param.page = (data.start / data.length) + 1;// 当前页码
								// param.darw=darw; //计数器
								var inviteTitle = $("#inviteCustomerTitle")
										.val().trim();
								if (inviteTitle != null && inviteTitle != "") {
									param.deptName = inviteTitle
								}
								param.employeeId = $("#pluralizeEmployeeId")
										.val();
								// console.log(param);
								// ajax请求数据
								$
										.ajax({
											type : "POST",
											url : "pluralizeList.do",
											cache : false, // 禁用缓存
											data : param, // 传入组装的参数
											dataType : "json",
											success : function(result) {
												if (result.code == 0) {
													// 获取并展示改用户已兼任的分公司
													var spanHtml = "<h5>已兼任公司：</h5>";
													for (var i = 0; i < result.userList.length; i++) {
														spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
																+ result.userList[i].deptName
																+ "&nbsp;&nbsp;</span>";

													}
													$("#pluralismDept").empty();
													$("#pluralismDept").append(
															spanHtml);
													setTimeout(
															function() {
																// 封装返回数据
																var returnData = {};
																draw = result.draw;// 后台返回的计数器
																returnData.draw = data.draw;// 这里直接自行返回了draw计数器,应该由后台返回
																returnData.recordsTotal = result.total;// 返回数据全部记录
																returnData.recordsFiltered = result.total;// 后台不实现过滤功能，每次查询均视作全部结果
																returnData.data = result.data;// 返回的数据列表

																// console.log(returnData);
																// 调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
																// 此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
																callback(returnData);
															}, 200);
												} else {
													location.href = "404.jsp";
												}
											}
										});
							},
							// 列表表头字段
							columns : [
									{
										"data" : null
									},
									{
										"data" : "deptName"
									},
									{
										"data" : function(data) {
											if (data.isPluralize == null
													|| data.isPluralize == "") {
												return "<input type=\"checkbox\" name='message' onclick=\"checkOnClick(this,3)\"  value=\""
														+ data.deptId + "\" />";
											} else {
												return "<input type=\"checkbox\" name='message'  onclick=\"checkOnClick(this,3)\" checked=\"checked\"  value=\""
														+ data.deptId + "\" />";
											}
										}
									} ],
							columnDefs : []
						})// .api();

		// 兼任部门数据表
		table5 = $("#dataTables-example5")
				.dataTable(
						{

							"fnDrawCallback" : function() {
								var api = this.api();
								var startIndex = api.context[0]._iDisplayStart;// 获取到本页开始的条数
								api.column(0).nodes().each(function(cell, i) {
									cell.innerHTML = startIndex + i + 1;
								});
							},
							language : lang, // 提示信息
							autoWidth : false, // 禁用自动调整列宽
							stripeClasses : [ "odd", "even" ], // 为奇偶行加上样式，兼容不支持CSS伪类的场合
							processing : true, // 隐藏加载提示,自行处理
							serverSide : true, // 启用服务器端分页
							searching : false, // 禁用原生搜索
							orderMulti : false, // 启用多列排序
							order : [], // 取消默认排序查询,否则复选框一列会出现小箭头
							renderer : "bootstrap", // 渲染样式：Bootstrap和jquery-ui
							pagingType : "simple_numbers", // 分页样式：simple,simple_numbers,full,full_numbers
							"aLengthMenu" : [ 10 ],
							"bLengthChange" : false,// 屏蔽tables的一页展示多少条记录的下拉列表
							ordering : false, // 关闭排序图标
							ajax : function(data, callback, settings) {
								// 封装请求参数
								var param = {};
								param.limit = data.length;// 页面显示记录条数，在页面显示每页显示多少项的时候
								param.start = data.start;// 开始的记录序号
								param.page = (data.start / data.length) + 1;// 当前页码
								// param.darw=darw; //计数器
								var inviteTitle = $("#inviteCustomerTitle")
										.val().trim();
								if (inviteTitle != null && inviteTitle != "") {
									param.deptName = inviteTitle
								}
								param.deptId = $("#pluralizeBranch").val();
								param.employeeId = $("#pluralizeEmployeeId")
										.val();
								// console.log(param);
								// ajax请求数据
								$
										.ajax({
											type : "POST",
											url : "pluralizeBranchList.do",
											cache : false, // 禁用缓存
											data : param, // 传入组装的参数
											dataType : "json",
											success : function(result) {
												if (result.code == 0) {
													// 获取并展示改用户已兼任的分公司
													var spanHtml = "<h5>已兼任部门：</h5>";
													for (var i = 0; i < result.userList.length; i++) {
														spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
																+ result.userList[i].branchName
																+ "&nbsp;&nbsp;</span>";

													}
													$("#pluralismBranch")
															.empty();
													$("#pluralismBranch")
															.append(spanHtml);
													setTimeout(
															function() {
																// 封装返回数据
																var returnData = {};
																draw = result.draw;// 后台返回的计数器
																returnData.draw = data.draw;// 这里直接自行返回了draw计数器,应该由后台返回
																returnData.recordsTotal = result.total;// 返回数据全部记录
																returnData.recordsFiltered = result.total;// 后台不实现过滤功能，每次查询均视作全部结果
																returnData.data = result.data;// 返回的数据列表

																// console.log(returnData);
																// 调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
																// 此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
																callback(returnData);
															}, 200);
												} else {
													location.href = "404.jsp";
												}
											}
										});
							},
							// 列表表头字段
							columns : [
									{
										"data" : null
									},
									{
										"data" : "branchName"
									},
									{
										"data" : function(data) {
											if (data.isPluralize == null
													|| data.isPluralize == "") {
												return "<input type=\"checkbox\" name='message' onclick=\"checkOnClick(this,2)\"  value=\""
														+ data.branchId
														+ "\" />";
											} else {
												return "<input type=\"checkbox\" name='message'  onclick=\"checkOnClick(this,2)\" checked=\"checked\"  value=\""
														+ data.branchId
														+ "\" />";
											}
										}
									} ],
							columnDefs : []
						})// .api();
		// 兼任团队数据表
		table6 = $("#dataTables-example6")
				.dataTable(
						{

							"fnDrawCallback" : function() {
								var api = this.api();
								var startIndex = api.context[0]._iDisplayStart;// 获取到本页开始的条数
								api.column(0).nodes().each(function(cell, i) {
									cell.innerHTML = startIndex + i + 1;
								});
							},
							language : lang, // 提示信息
							autoWidth : false, // 禁用自动调整列宽
							stripeClasses : [ "odd", "even" ], // 为奇偶行加上样式，兼容不支持CSS伪类的场合
							processing : true, // 隐藏加载提示,自行处理
							serverSide : true, // 启用服务器端分页
							searching : false, // 禁用原生搜索
							orderMulti : false, // 启用多列排序
							order : [], // 取消默认排序查询,否则复选框一列会出现小箭头
							renderer : "bootstrap", // 渲染样式：Bootstrap和jquery-ui
							pagingType : "simple_numbers", // 分页样式：simple,simple_numbers,full,full_numbers
							"aLengthMenu" : [ 10 ],
							"bLengthChange" : false,// 屏蔽tables的一页展示多少条记录的下拉列表
							ordering : false, // 关闭排序图标
							ajax : function(data, callback, settings) {
								// 封装请求参数
								var param = {};
								param.limit = data.length;// 页面显示记录条数，在页面显示每页显示多少项的时候
								param.start = data.start;// 开始的记录序号
								param.page = (data.start / data.length) + 1;// 当前页码
								// param.darw=darw; //计数器
								var inviteTitle = $("#inviteCustomerTitle")
										.val().trim();
								if (inviteTitle != null && inviteTitle != "") {
									param.deptName = inviteTitle
								}
								param.deptId = $("#pluralizeTeam").val();
								param.branchId = $("#pluralizeBranchBranch")
										.val();
								param.employeeId = $("#pluralizeEmployeeId")
										.val();
								// console.log(param);
								// ajax请求数据
								$
										.ajax({
											type : "POST",
											url : "pluralizeTeamList.do",
											cache : false, // 禁用缓存
											data : param, // 传入组装的参数
											dataType : "json",
											success : function(result) {
												if (result.code == 0) {
													// 获取并展示改用户已兼任的分公司
													var spanHtml = "<h5>已兼任团队：</h5>";
													for (var i = 0; i < result.userList.length; i++) {
														spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
																+ result.userList[i].branchName
																+ "&nbsp;&nbsp;</span>";

													}
													$("#pluralismTeam").empty();
													$("#pluralismTeam").append(
															spanHtml);
													setTimeout(
															function() {
																// 封装返回数据
																var returnData = {};
																draw = result.draw;// 后台返回的计数器
																returnData.draw = data.draw;// 这里直接自行返回了draw计数器,应该由后台返回
																returnData.recordsTotal = result.total;// 返回数据全部记录
																returnData.recordsFiltered = result.total;// 后台不实现过滤功能，每次查询均视作全部结果
																returnData.data = result.data;// 返回的数据列表

																// console.log(returnData);
																// 调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
																// 此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
																callback(returnData);
															}, 200);
												} else {
													location.href = "404.jsp";
												}
											}
										});
							},
							// 列表表头字段
							columns : [
									{
										"data" : null
									},
									{
										"data" : "branchName"
									},
									{
										"data" : function(data) {
											if (data.isPluralize == null
													|| data.isPluralize == "") {
												return "<input type=\"checkbox\" name='message' onclick=\"checkOnClick(this,1)\"  value=\""
														+ data.branchId
														+ "\" />";
											} else {
												return "<input type=\"checkbox\" name='message'  onclick=\"checkOnClick(this,1)\" checked=\"checked\"  value=\""
														+ data.branchId
														+ "\" />";
											}
										}
									} ],
							columnDefs : []
						})// .api();
		if ($("#company").size() == 1) {
			$("#company").trigger("change");
		}
	});
	function cpmpanyChage(id, bran) {
		if (bran == null || bran == "" || id == null || id == "") {
			return;
		}
		$
				.ajax({
					url : "getDeptFallTeam.do",
					type : "post",
					data : {
						id : id
					},
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							var branchHtml = "";
							for (var i = 0; i < result.branch.length; i++) {
								branchHtml += "<option value=\""
							+ result.branch[i].branchId + "\">"
										+ result.branch[i].branchName
										+ "</option>";
							}
							$("#edit-team option:not(:first)").remove();
							$("#add-team option:not(:first)").remove();
							$("#" + bran + " option:not(:first)").remove();
							$("#" + bran).append(branchHtml);
						} else {
							sweetAlert("提示", "未知异常!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});// ajax end;

	}

	function teamChage(id, bran) {
		if (bran == null || bran == "" || id == null || id == "") {
			return;
		}
		$
				.ajax({
					url : "getDeptFallTeam.do",
					type : "post",
					data : {
						pid : id
					},
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							var branchHtml = "";
							for (var i = 0; i < result.branch.length; i++) {
								branchHtml += "<option value=\""
							+ result.branch[i].branchId + "\">"
										+ result.branch[i].branchName
										+ "</option>";
							}
							$("#" + bran + " option:not(:first)").remove();
							$("#" + bran).append(branchHtml);
						} else {
							sweetAlert("提示", "未知异常!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});// ajax end;

	}

	function cpmpanyLoad(id, bid) {
		if (bid == null || bid == "" || id == null || id == "") {
			return;
		}
		$
				.ajax({
					url : "getDeptFallTeam.do",
					type : "post",
					data : {
						id : id
					},
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							var branchHtml = "";
							for (var i = 0; i < result.branch.length; i++) {
								branchHtml += "<option value=\""
							+ result.branch[i].branchId + "\">"
										+ result.branch[i].branchName
										+ "</option>";
							}
							$("#edit-branch").append(branchHtml);
							$("#edit-branch").val(bid);
						} else {
							sweetAlert("提示", "未知异常!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});// ajax end;

	}
	function cpmpanyPid(id, bid) {
		if (bid == null || bid == "" || id == null || id == "") {
			return;
		}
		$
				.ajax({
					url : "getDeptFallTeam.do",
					type : "post",
					data : {
						pid : id
					},
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							var branchHtml = "";
							for (var i = 0; i < result.branch.length; i++) {
								branchHtml += "<option value=\""
							+ result.branch[i].branchId + "\">"
										+ result.branch[i].branchName
										+ "</option>";
							}
							$("#edit-team").append(branchHtml);
							$("#edit-team").val(bid);
						} else {
							sweetAlert("提示", "未知异常!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});// ajax end;

	}
	// 修改密码前展示需要修改用户的信息
	function modifyPasswordBeforeQuery(id) {
		$.ajax({
			url : "queryEmployeeById.do",
			data : {
				empId : id
			},
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					// 展示修改密码模态框
					$("#modifyPasswordModal").modal("show");
					// 成功返回
					var emp = result.emp;
					$("#modify-id").val(emp.employeeId);
					$("#modify-name").val(emp.name);
					$("#modify-userCard").val(emp.userCard);
					$("#modify-phoneNumber").val(emp.phoneNumber);

				} else { // 500
					sweetAlert("错误", "出现未知错误!", "error");
				}
			},
			error : function() {
				sweetAlert("错误", "网络出现异常!", "error");
			}
		});
	}

	// 修改设备码前展示需要修改用户的信息
	function deviceQuery(id) {
		$.ajax({
			url : "queryEmployeeById.do",
			data : {
				empId : id
			},
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					// 展示修改密码模态框
					$("#deviceCodeModal").modal("show");
					// 成功返回
					var emp = result.emp;
					$("#deviceCode-id").val(emp.employeeId);
					$("#deviceCode-name").val(emp.name);
					$("#mobileDeviceCode").val(emp.mobileDeviceCode);
					$("#panelComputerDeviceCode").val(
							emp.panelComputerDeviceCode);
					$("#pcDeviceCode").val(emp.pcDeviceCode);
					$("#iosPanelComputerDeviceCode").val(
							emp.iosPanelComputerDeviceCode);

				} else { // 500
					sweetAlert("错误", "出现未知错误!", "error");
				}
			},
			error : function() {
				sweetAlert("错误", "网络出现异常!", "error");
			}
		});
	}
	// 修改兼任前展示需要修改用户的信息
	function pluralizeQuery(id) {
		arrayList.splice(0, arrayList.length);
		deleteList.splice(0, deleteList.length);
		console.log(deleteList);
		pType = "";
		$("#pluralizeEmployeeId").val(id);
		$.ajax({
			url : "queryEmployeeById.do",
			data : {
				empId : id
			},
			type : "post",
			dataType : "json",
			success : function(result) {
				if (result.code == 1) {
					$("#deptModal").hide();
					$("#branchModal").hide();
					$("#teamModal").hide();
					$("#addInviteCustomerModal").modal("show");
					// 成功返回
					var emp = result.emp;
					if (emp.quarters == 1) {
						$("#teamModal").show();
						$("#pluralizeTeam").trigger("change");
						Search6();
					} else if (emp.quarters == 2) {
						$("#branchModal").show();
						Search5();
					} else {
						$("#deptModal").show();
						Search3();
					}

				} else { // 500
					sweetAlert("提示", "操作失败,请刷新后重试!", "error");
				}
			},
			error : function() {
				sweetAlert("错误", "网络出现异常!", "error");
			}
		});
	}

	// 搜索功能
	function Search() {
		/*
		 * var oSettings = table.fnSettings(); oSettings._iDisplayStart = 0;
		 * table.fnDraw(oSettings);
		 */
		table.fnDraw();
	}
	// 搜索功能
	function Search3() {
		/*
		 * var oSettings = table.fnSettings(); oSettings._iDisplayStart = 0;
		 * table.fnDraw(oSettings);
		 */
		table3.fnDraw();
	}
	// 搜索功能
	function Search4() {
		/*
		 * var oSettings = table.fnSettings(); oSettings._iDisplayStart = 0;
		 * table.fnDraw(oSettings);
		 */
		table4.fnDraw();
	}
	// 搜索功能
	function Search5() {
		/*
		 * var oSettings = table.fnSettings(); oSettings._iDisplayStart = 0;
		 * table.fnDraw(oSettings);
		 */
		table5.fnDraw();
	}
	// 搜索功能
	function Search6() {
		/*
		 * var oSettings = table.fnSettings(); oSettings._iDisplayStart = 0;
		 * table.fnDraw(oSettings);
		 */
		table6.fnDraw();
	}

	$("#modifyPasswordBtn").click(
			function() { //“登录”按钮单击事件
				//获取用户名称
				var id = $("#modify-id").val();
				var relpwd = $("#modify-relpwd").val();
				var password = $("#modify-password").val();
				var confirm_password = $("#modify-confirm_password").val();

				if (password != confirm_password) {
					swal("请重新输入新密码与确认新密码", "新密码与确认新密码不一致", "error");
					return false;
				} else if (confirm_password != "" && password != ""
						&& password.length < 5) {
					swal("请重新输入新密码与确认新密码", "密码长度必须大于五位", "error");
					return false;
				}

				if (confirm_password != "" && password != "") {
					$.ajax({
						url : "changePasswordByAdmin.do",
						type : "post",
						data : {
							password : password,
							id : id
						},
						async : false,
						error : function(request) {
							swal("修改失败!", "密码修改提示!", "error");
						},
						success : function(data) {
							if (data.code == 1) {
								swal("修改成功", "修改密码提示", "success");
								closeModal(modifyPasswordModal);
							} else {
								swal("修改失败!", "密码修改提示!", "error");
							}
							// 				$('#signupForm')[0].reset();
						}
					});
				} else {
					swal("请填写新密码", "新密码不能为空", "error");
				}
			});
	$("#deviceCodeBtn")
			.click(
					function() { // “登录”按钮单击事件
						// 获取用户名称
						var id = $("#deviceCode-id").val();
						var mobileDeviceCode = $("#mobileDeviceCode").val();
						var panelComputerDeviceCode = $(
								"#panelComputerDeviceCode").val();
						var pcDeviceCode = $("#pcDeviceCode").val();
						var iosPanelComputerDeviceCode = $(
								"#iosPanelComputerDeviceCode").val();

						$
								.ajax({
									url : "updateDevice.do",
									type : "post",
									data : {
										mobileDeviceCode : mobileDeviceCode,
										panelComputerDeviceCode : panelComputerDeviceCode,
										iosPanelComputerDeviceCode : iosPanelComputerDeviceCode,
										pcDeviceCode : pcDeviceCode,
										employeeId : id
									},
									error : function(request) {
										swal("设置失败!", "提示!", "error");
									},
									success : function(data) {
										if (data.code == 1) {
											swal("提示", "设置成功", "success");
											closeModal(deviceCodeModal)
										} else {
											swal("提示", "设置失败!", "error");
										}
										// $('#signupForm')[0].reset();
									}
								});
					});
	// 显示modal
	function showModal(modal) {
		$(modal).modal("show");
		$('#editForm')[0].reset();
		$('#addFrom')[0].reset();
	}
	// 隐藏modal
	function closeModal(modal) {
		$(modal).modal("hide");
	}

	// 图片上传赋值事件
	$('input[id=hotelImgFile1]').change(function() {
		$('#photoCover').val($(this).val());
	});
	$('input[id=hotelImgFile2]').change(function() {
		$('#photoCover2').val($(this).val());
	});
	$('input[id=hotelImgFile3]').change(function() {
		$('#photoCover3').val($(this).val());
	});

	// 单选框样式
	$(document).ready(function() {
		$(".i-checks").iCheck({
			checkboxClass : "icheckbox_square-green",
			radioClass : "iradio_square-green",
		})
	});
	function cpmpanyChage1(id, bran) {
		$("#" + bran + " option:not(:first)").remove();
		$("#team" + " option:not(:first)").remove();
		Search();
		if ($("#company").val() != "" && $("#company").val() != null) {
			$
					.ajax({
						url : "getDeptFallTeam.do",
						type : "post",
						data : {
							id : id
						},
						dataType : "json",
						success : function(result) {
							if (result.code == 1) {
								var branchHtml = "";
								for (var i = 0; i < result.branch.length; i++) {
									branchHtml += "<option value=\""
								+ result.branch[i].branchId + "\">"
											+ result.branch[i].branchName
											+ "</option>";
								}
								$("#" + bran + " option:not(:first)").remove();
								$("#" + bran).append(branchHtml);
								$("#team" + " option:not(:first)").remove();

							} else {
								sweetAlert("提示", "未知异常!", "error");
							}
						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}
					});// ajax end;
		}
	}
	function cpmpanyBranch(id) {
		$("#pluralizeBranchBranch option:not(:first)").remove();
		Search6();
		if ($("#pluralizeTeam").val() != ""
				&& $("#pluralizeTeam").val() != null) {
			$
					.ajax({
						url : "getDeptFallTeam.do",
						type : "post",
						data : {
							id : id
						},
						dataType : "json",
						success : function(result) {
							if (result.code == 1) {
								var branchHtml = "";
								for (var i = 0; i < result.branch.length; i++) {
									branchHtml += "<option value=\""
								+ result.branch[i].branchId + "\">"
											+ result.branch[i].branchName
											+ "</option>";
								}
								$("#pluralizeBranchBranch").append(branchHtml);

							} else {
								sweetAlert("提示", "未知异常!", "error");
							}
						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}
					});// ajax end;
		}
	}
	function branchChage(id, team) {
		$("#" + team + " option:not(:first)").remove();
		Search();
		$
				.ajax({
					url : "getTeamByBranchId.do",
					type : "post",
					data : {
						id : id
					},
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							var branchHtml = "";
							for (var i = 0; i < result.branch.length; i++) {
								branchHtml += "<option value=\""
							+ result.branch[i].branchId + "\">"
										+ result.branch[i].branchName
										+ "</option>";
							}
							$("#" + team + " option:not(:first)").remove();
							$("#" + team).append(branchHtml);
						} else {
							sweetAlert("提示", "未知异常!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});// ajax end;
	}
	// 关闭modal
	function modalClose(htmlObj) {
		$(htmlObj).modal("hide");
	}
	// check选中事件
	function checkOnClick(value, pluralizeType) {
		pType = pluralizeType;
		var branchId = "";
		var deptId = "";
		if (pluralizeType == 1) {
			deptId = $("#pluralizeTeam").val();
			branchId = $("#pluralizeBranchBranch").val();
		} else if (pluralizeType == 2) {
			deptId = $("#pluralizeBranch").val();
		}
		if ($(value).is(':checked')) {
			$.ajax({
				url : "insertPluralize.do",
				data : {
					deptId : $(value).val(),
					employeeId : $("#pluralizeEmployeeId").val(),
					pluralizeType : pluralizeType
				},
				type : "post",
				dataType : "json",
				success : function(result) {
					if (result.code == 0) {
						arrayList.push($(value).val());
						console.log(arrayList);
						/* swal({
						title : "提示",
						text : "添加成功！",
						type : "success",
						confirmButtonColor : "#DD6B55",
						confirmButtonText : "确定"
						}, function() {
						getPluralize($("#pluralizeEmployeeId").val());
						});  */
						getPluralize($("#pluralizeEmployeeId").val(),
								pluralizeType,deptId,branchId);
					} else {
						sweetAlert("提示", "操作失败,请刷新后重试!", "error");
					}

				},
				error : function() {
					sweetAlert("异常", "网络出现异常!", "error");
				}

			});// ajax end; 
		} else {
			$.ajax({
				url : "deletePluralize.do",
				data : {
					employeeId : $("#pluralizeEmployeeId").val(),
					deptId : $(value).val(),
					pluralizeType : pluralizeType
				},
				type : "post",
				dataType : "json",
				success : function(result) {
					if (result.code == 0) {
						deleteList.push($(value).val());
						console.log(deleteList);
						/* swal({
							title : "提示",
							text : "删除成功！",
							type : "success",
							confirmButtonColor : "#DD6B55",
							confirmButtonText : "确定"
						}, function() {
							
						});  */

						getPluralize($("#pluralizeEmployeeId").val(),
								pluralizeType,deptId,branchId);
					} else {
						sweetAlert("提示", "操作失败,请刷新后重试!", "error");
					}

				},
				error : function() {
					sweetAlert("异常", "网络出现异常!", "error");
				}
			});// ajax end; 
		}
	}
	function getPluralize(empId, pluralizeType,deptId,branchId) {
		$
				.ajax({
					type : "POST",
					url : "getPluralizeList.do",
					cache : false, // 禁用缓存
					data : {
						"employeeId" : empId,
						pluralizeType : pluralizeType,
						deptId : deptId,
						branchId : branchId
					}, // 传入组装的参数
					dataType : "json",
					success : function(result) {
						if (result.code == 0) {

							if (pluralizeType == 1) {
								// 获取并展示改用户已兼任的团队
								var spanHtml = "<h5>已兼任分团队：</h5>";
								for (var i = 0; i < result.userList.length; i++) {
									spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
											+ result.userList[i].branchName
											+ "&nbsp;&nbsp;</span>";

								}
								console.log(spanHtml);
								$("#pluralismTeam").empty();
								$("#pluralismTeam").append(spanHtml);
							} else if (pluralizeType == 2) {
								// 获取并展示改用户已兼任的部门
								var spanHtml = "<h5>已兼任部门：</h5>";
								for (var i = 0; i < result.userList.length; i++) {
									spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
											+ result.userList[i].branchName
											+ "&nbsp;&nbsp;</span>";

								}
								console.log(spanHtml);
								$("#pluralismBranch").empty();
								$("#pluralismBranch").append(spanHtml);
							} else if (pluralizeType == 3) {
								// 获取并展示改用户已兼任的分公司
								var spanHtml = "<h5>已兼任分公司：</h5>";
								for (var i = 0; i < result.userList.length; i++) {
									spanHtml += "<span style=\"width: 14.25%;\" >&nbsp;&nbsp;"
											+ result.userList[i].deptName
											+ "&nbsp;&nbsp;</span>";

								}
								console.log(spanHtml);
								$("#pluralismDept").empty();
								$("#pluralismDept").append(spanHtml);
							}

						}
					}
				});
	}
	function getYes() {
		if (arrayList.length > 0 || deleteList.length > 0) {
			/* var textContent="新增：";
			var textContent2="删除：";
			$.each(arrayList,function(index,value){
				if(typeof(value)!="undefined"){
			     $.ajax({
						url : "companyDetail.do",
						async :false,
						data : {
							id : value
						},
						type : "post",
						dataType : "json",
						success : function(result) {
							if (result.code == 1) {
								textContent+=result.dept.deptName+"("+result.dept.remake+"),"
							}
			
						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}
					});// ajax end; 
				}
			});
			$.each(deleteList,function(index,value){
				if(typeof(value)!="undefined"){
					 $.ajax({
							url : "companyDetail.do",
							async :false,
							data : {
								id : value
							},
							type : "post",
							dataType : "json",
							success : function(result) {
								if (result.code == 1) {
									textContent2+=result.dept.deptName+"("+result.dept.remake+"),"
								}
			
							},
							error : function() {
								sweetAlert("异常", "网络出现异常!", "error");
							}
						});// ajax end; 
				}
			}); */
			swal({
				title : "提示",
				text : "操作成功！",
				type : "success",
				confirmButtonColor : "#DD6B55",
				confirmButtonText : "确定"
			}, function() {
				modalClose('#addInviteCustomerModal')
			});

		} else {
			modalClose('#addInviteCustomerModal')
		}
	}
	function getNo() {//取消操作
		if (arrayList.length > 0 || deleteList.length > 0) {
		swal({
			title : "您确定要关闭窗口！",
			text : "关闭后将无法保存您刚刚的操作，请谨慎操作！",
			type : "warning",
			showCancelButton : true,
			confirmButtonColor : "#DD6B55",
			confirmButtonText : "关闭",
			cancelButtonText : "取消",
		}, function() {
			$.each(arrayList, function(index, value) {
				if (typeof (value) != "undefined") {
					$.ajax({
						url : "deletePluralize.do",
						data : {
							employeeId : $("#pluralizeEmployeeId").val(),
							deptId : value,
							pluralizeType : pType
						},
						type : "post",
						dataType : "json",
						success : function(result) {
							if (result.code == 0) {
								deleteList.push($(value).val());
								/* swal({
									title : "提示",
									text : "删除成功！",
									type : "success",
									confirmButtonColor : "#DD6B55",
									confirmButtonText : "确定"
								}, function() {
									
								});  */
								getPluralize($("#pluralizeEmployeeId").val());
							}

						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}
					});// ajax end; 
				}
			});
			$.each(deleteList, function(index, value) {
				if (typeof (value) != "undefined") {
					$.ajax({
						url : "insertPluralize.do",
						data : {
							employeeId : $("#pluralizeEmployeeId").val(),
							deptId : value,
							pluralizeType : pType
						},
						type : "post",
						dataType : "json",
						success : function(result) {
							if (result.code == 0) {
								deleteList.push($(value).val());
								/* swal({
									title : "提示",
									text : "删除成功！",
									type : "success",
									confirmButtonColor : "#DD6B55",
									confirmButtonText : "确定"
								}, function() {
									
								});  */
								getPluralize($("#pluralizeEmployeeId").val());
							}
						},
						error : function() {
							sweetAlert("异常", "网络出现异常!", "error");
						}
					});// ajax end; 
				} else {

				}
			});
			modalClose('#addInviteCustomerModal');
		});
		}else{
			modalClose('#addInviteCustomerModal');
		}
	}
</script>
</html>